﻿using System;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace SecurityAgent
{
    [ServiceContract]
    interface IFieldSecurityService
    {
        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        int GetFieldAuthorization(string applicationKey, string userToken, string objectName, string fieldName);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        FieldClaim GetFieldClaim(string applicationKey, string userToken, string objectName, string fieldName);
        
        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        bool IsFieldAuthorized(string applicationKey, string userToken, string objectName, string fieldName, int operation);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        string GetFieldSettingValue(string applicationKey, string userToken, string objectName, string fieldName, string setting);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        string GetFieldSettings(string applicationKey, string userToken, string objectName, string fieldName);
    }
}
